1. Technology Field
The present invention relates to a data moving method for a flash memory module, a memory controller using the method, and a memory storage apparatus using the method.
2. Description of Related Art
Digital cameras, mobile phones, and MP3 music players have undergone rapid growth in recent years, so that consumer demand for storage media has also drastically increased. Since a rewritable non-volatile memory has the characteristics of non-volatility of data, low power consumption, small volume, non-mechanical structure, and fast reading and writing speed, the rewritable non-volatile memory is the most adaptable memory to be applied in a portable electronic product, such as a mobile phone, a personal digital assistant (PDA), a notebook computer, and so on. For instance, a conspicuous solid state drive (SSD) is a storage apparatus which utilizes a flash memory as its storage medium. Therefore, the flash memory industry has become a very popular part of the electronic industry in recent years. A flash memory module has a plurality of physical blocks, and each of the physical blocks has a plurality of physical pages, wherein data must be written into a physical block according to the sequence of the physical pages in the physical block. In addition, a physical page containing data has to be erased before it is used for a new data writing operation. Particularly, each physical block is the smallest erasing unit, and each physical page is the smallest programming (i.e., writing) unit.
Hence, in order to improve the operation efficiency, a memory controller of a memory storage apparatus groups the physical blocks of a flash memory module into a data area and a spare area.
Physical blocks in the data area are used for storing data written by a host system. To be more specific, a memory management circuit converts a logical access address accessed by the host system into a logical page of a logical block and maps the logical pages of the logical blocks to physical pages of the physical blocks in the data area. Namely, in the management of a flash memory module, the physical blocks in the data area are deemed used physical blocks (for instance, the physical blocks already contain data written by a host system). Additionally, the memory management circuit records the mapping relationship between the logical blocks and the physical blocks of the data area in a logical block-physical block mapping table, and the logical pages of each logical block are sequentially mapped to the physical pages of the corresponding physical block.
Physical blocks in the spare area are used for substituting the physical blocks in the data area. In particular, a physical block already containing data has to be erased before it is used for a new data writing operation, and thus the physical blocks in the spare area are used for writing updated data to substitute the physical blocks originally mapped to the logical blocks. Hence, the physical blocks in the spare area are either blank blocks or available blocks (i.e., these blocks do not contain data, or these blocks contain data marked as invalid data).
That is to say, when the storage space of the memory storage apparatus is formatted, the physical blocks in the data area are mapped to the logical blocks and considered already containing update data. Subsequently, when the host system is about to store data into a logical page of a logical block, the memory controller selects a physical block from the spare area and writes the data into a physical page of the selected physical block, so as to complete the data update at the logical page.
Along with the development of semiconductor technologies, the page capacity of each physical page in a flash memory module has been increasing. For instance, each physical page in an existing flash memory module is usually designed to store 8 kilobytes (KB) of user data (i.e., the page capacity is 8 KB). However, an operating system (OS) of a host system (e.g., a personal computer) usually stores data in a smaller unit (e.g., 4 KB). For instance, the OS may merely update the preceding 4 KB of data at one logical page. After other access operations are done, the OS then updates the succeeding 4 KB of data in this logical page. Hence, the updated data belonging to the same logical page may be stored in several physical pages. For instance, when the preceding 4 KB of data in one logical page is updated, the updated 4 KB of data and the invalid 4 KB of data are written into one physical page. When the succeeding 4 KB of data in this logical page is updated, the invalid 4 KB of data and the updated succeeding 4 KB of data are written into another physical page. Afterwards, when the data in the logical page need be arranged, the updated data of this logical page is read from the physical pages and written into a blank physical page. Accordingly, how to effectively move the data belonging to the same logical page from the physical pages to a blank physical page for improving the performance of the memory storage apparatus has become one of the major subjects in the industry.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the invention, or that any reference forms a part of the common general knowledge in the art.